package com.xxx.controller;

import com.alibaba.fastjson.JSONObject;
import com.xxx.doc.CourseDoc;
import com.xxx.dto.CourseSearchDto;
import com.xxx.result.JSONResult;
import com.xxx.result.PageList;
import com.xxx.service.ICourseDocService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/coursedoc")
public class CourseDocController {

    @Autowired
    private ICourseDocService courseDocService;

    @PostMapping("/search")
    public JSONResult search(@RequestBody CourseSearchDto courseSearchDto) {
      PageList<CourseDoc> pageList = courseDocService.search(courseSearchDto);
        return JSONResult.success(pageList);
    }

    @PostMapping("/save")
    public JSONResult save(@RequestBody CourseDoc courseDoc) {
        courseDocService.save(courseDoc);
        return JSONResult.success();
    }

}
